package ooday04home;

public class Test {
    public static void main(String[] args) {
        Animal[] animals = new Animal[5];
        animals[0] = new Dog("小黑", 6, "白色");
        animals[1] = new Dog("花花", 1, "黄色");
        animals[2] = new Chick("小白", 2, "白色");
        animals[3] = new Chick("多多", 3, "灰色");
        animals[4] = new Fish("球球", 1, "金色");
        for (int i = 0; i < animals.length; i++) {
            animals[i].eat();
            animals[i].druik();
            if (animals[i] instanceof Dog) {
                Dog gg = (Dog) animals[i];
                gg.swim();
                gg.housekeeping();
            }
            if (animals[i] instanceof Chick) {
                Chick jj = (Chick) animals[i];
                jj.layegg();
            }
            if (animals[i] instanceof Fish) {
                Fish yy = (Fish) animals[i];
                yy.swim();

            }

        }
    }
}
